def find_highest_and_lowest_scores():
    # 读取学生个数
    num_students = int(input())
    
    # 初始化最高分和最低分为None
    highest_score = None
    lowest_score = None
    
    # 读取每个学生的分数
    for _ in range(num_students):
        score = int(input())
        
        # 更新最高分和最低分
        if highest_score is None or score > highest_score:
            highest_score = score
        if lowest_score is None or score < lowest_score:
            lowest_score = score
    
    # 输出最高分和最低分
    print(highest_score)
    print(lowest_score)

# 示例使用
find_highest_and_lowest_scores()